package codename.carrot.bomberman.network;

import codename.carrot.bomberman.game.gamemessages.BombermanMessage;
import codename.carrot.bomberman.network.events.ReceiveEvent;

/**
 * An abstract class of the game post office. The post office main function is
 * to sort and distribute messages throughout the game.
 * 
 * The post office is the main link between messages received for the network
 * and the game.
 * 
 * @author Group A4.
 * 
 */
public abstract class PostOffice {

	/**
	 * String for debugging.
	 */
	protected String DEBUG = this.getClass().getSimpleName();

	/**
	 * Destroy the post office (setting to null).
	 */
	public abstract void destroy();

	/**
	 * Sort the incoming message.
	 * 
	 * @param e
	 *            The message to sort.
	 */
	protected abstract void sortMessage(ReceiveEvent e);

	/**
	 * Send a message over the network. - This is mainly for use within the
	 * client.
	 * 
	 * @param message
	 *            The message to be sent.
	 */
	protected abstract void sendMessage(BombermanMessage message);

	/**
	 * Send a message over the network from a specific client. - This is mainly
	 * for use within the server.
	 * 
	 * @param message
	 *            The message to be sent.
	 * @param clientFrom
	 *            The ID of the client where the message came from.
	 */
	protected abstract void sendMessage(BombermanMessage message, int clientFrom);
}
